const mongoose = require('mongoose');

/* 
  name 商品名字 String required
  price number required 价格
  desc  String 商品描述
  createAt 上架时间 number
  onoff  布尔值 是否上架
  thumb  string 封面图片
  content  富文本数据 String
*/

const itemSchema = new mongoose.Schema({
  name: {
    type: String,
    required: true
  },
  price: {
    type: Number,
    required: true
  },
  desc: String,
  createAt: {
    type: String,
    required: true
  },
  onoff: {
    type: Boolean,
    default: true
  },
  thumb: String, // 上传成功的封面图片的地址
  content: String
})

const itemModel = mongoose.model('qf_items', itemSchema);

module.exports = itemModel;